/**
 * Copyright 2008-2009. Chongqing Communications Industry Services Co.,Ltd Information Technology Branch. All rights
 * reserved. <a>http://www.cqcis.com</a>
 */
package com.cqcis.uip.base.framework.common;

import com.cqcis.uip.base.framework.common.impl.AttributesImpl;

/**
 * 控制信息，用于发布系统控制信息.与普通信息相区分
 * 
 * @author huangmy
 * @date   2008-5-28
 */
public class ControlMsg extends AttributesImpl<Object> {
	private static final long serialVersionUID = 1L;
	private String message; // 信息
    private Object attachement; // 关联对象
    private boolean controlMsg = true; // 是控制信息, 控制信息是指用于系统消息发布的信息,
                                       // 内部包装String字符串
    
    public ControlMsg() {
    	// do nothing
    }
    
    public ControlMsg(String message) {
    	if (message == null) {
    		throw new NullPointerException("the message can't be null");
    	}
    	
    	this.message = message;
    }
    
    @Override
    public String toString() {
    	StringBuffer b = new StringBuffer();
    	b.append("{ControlMsg: isControlMsg=").append(this.controlMsg)
    	 .append(", message=").append(this.message)
    	 .append(", attachement=").append(this.attachement)
    	 .append(", attributes=").append(getAttributes())
    	 .append("}");
    	return b.toString();
    }

	public String getMessage() {
		return message != null ? message : "";
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getAttachement() {
		return attachement;
	}

	public void setAttachement(Object attachement) {
		this.attachement = attachement;
	}

	public boolean isControlMsg() {
		return controlMsg;
	}

	public void setControlMsg(boolean controlMsg) {
		this.controlMsg = controlMsg;
	}
}
